package com.example.terminalservice.exception;

import com.example.terminalservice.common.CodeEnum;
import lombok.Data;

/**
 * @author 28142
 * @description 自定义异常
 * @date 2023/8/4 17:03
 */
@Data
public class MyException extends RuntimeException {
    private Integer code;
    private String msg;

    public MyException() {
        super();
    }

    public MyException(String msg) {
        super(msg);
    }

    public MyException(CodeEnum codeEnum) {
        super(codeEnum.getMsg());
        this.code = codeEnum.getCode();
    }

    public MyException(Integer code, String msg) {
        super(msg);
        this.code = code;
    }

    public MyException(String msg, Throwable e) {
        super(msg, e);
    }

    public MyException(Integer code, String msg, Throwable e) {
        super(msg, e);
        this.code = code;
    }
}
